#!/bin/bash
FlagScale_HOME=<xxxx>
PROJ_HOME=<xxxx>
EXPNAME=<xxxx>
DATA_PATH=<xxxx>
set -u
  HOSTFILE=$PROJ_HOME/config/hostfile
  LOG_FILE="examples/aquila/$EXPNAME.log"
  SCRIPT_FILE="examples/aquila/pretrain_aquila_7b_mup_distributed.sh"
set +u

hostlist=$(cat $HOSTFILE | awk '{print $1}' | xargs)
for host in ${hostlist[@]}; do
  echo $host
  ssh -f -n $host "sh -c 'cd $FlagScale_HOME; nohup bash $SCRIPT_FILE $PROJ_HOME $EXPNAME $DATA_PATH >> $LOG_FILE 2>&1 &'"
done
